<?php
require_once('includes/db.php');
unset($_POST['submit']);
$date = date('Y-m-d H:i:s');

$query = "INSERT INTO `users` SET
`status` = '1',
`created_date` = '$date',
";

foreach ($_POST as $colName=>$value)
{
  $query .= "`$colName`= '$value',";
}
$query = rtrim($query, ' ,');
pr($query);

mysql_query($query) or die(mysql_error());

$lastInsertedId = mysql_insert_id();

echo "User inserted on Id : $lastInsertedId \n\n";

